package com.vca.service.dao.order;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vca.common.model.order.StoreOrder;
import com.vca.common.request.OrderBrokerageData;
import com.vca.common.request.StoreDateRangeSqlPram;
import com.vca.common.request.StoreOrderStaticsticsRequest;
import com.vca.common.response.MyAppointmentItemResponse;
import com.vca.common.response.StoreOrderStatisticsChartItemResponse;
import com.vca.common.response.StoreStaffDetail;
import com.vca.common.vo.DetailClientVo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 订单表 Mapper 接口
 */
public interface StoreOrderDao extends BaseMapper<StoreOrder> {

    /**
     * 订单总金额
     */
    BigDecimal getTotalPrice(String where);

    /**
     * 退款总金额
     */
    BigDecimal getRefundPrice(String where);

    /**
     * 获取退款总单数
     */
    Integer getRefundTotal(String where);

    /**
     * 核销详情 月数据
     * @param request 分页和日期
     * @return 月数据
     */
    List<StoreStaffDetail> getOrderVerificationDetail(StoreOrderStaticsticsRequest request);

    /**
     * 订单统计详情 price
     * @param pram 时间区间参数
     * @return 月数据
     */
    List<StoreOrderStatisticsChartItemResponse> getOrderStatisticsPriceDetail(StoreDateRangeSqlPram pram);

    /**
     * 订单统计详情 订单量
     * @param pram 时间区间参数
     * @return 月数据
     */
    List<StoreOrderStatisticsChartItemResponse> getOrderStatisticsOrderCountDetail(StoreDateRangeSqlPram pram);

    /**
     * 获取佣金相关数据
     * @param uid 用户uid
     * @param spreadId 推广人uid
     */
    OrderBrokerageData getBrokerageData(@Param("uid") Integer uid, @Param("spreadId") Integer spreadId);

    /**
     * 根据类型统计用户 课程/讲座/展览 数量
     * @param userId
     * @param currentTime
     * @param type
     * @return
     */
    Integer getCount(@Param("userId") Integer userId,@Param("currentTime") String currentTime,@Param("type") Integer type);

    /**
     * 查询这个月已经完成的订单
     * @param userId
     * @return
     */
    List<StoreOrder> getMonthIsCompleteOrder(@Param("userId") Integer userId);

    /**
     * 我的预约项目
     * @param userId
     * @return
     */
    List<MyAppointmentItemResponse> getAppointment(@Param("userId") Integer userId, @Param("type") Integer type, @Param("mainType") Integer mainType);

    /**
     * @description  跟据讲座id和用户id查询讲座订单
     * @methodName getTalkOrderByScheduleId
     * @param talkId
     * @param uid
     * @author Li
     * @date 2022/12/29 10:17
     * @return com.vca.common.model.order.StoreOrder
     */
    List<StoreOrder> getTalkOrderByScheduleId(Long talkId, Integer uid);

    List<DetailClientVo> detailClient(StoreDateRangeSqlPram pram);

    List<DetailClientVo> detailClientOrderByInfo(@Param("cardList") List<Integer> cardList);

    List<StoreOrder> summaryDay(@Param("start")String start,@Param("end")String end);

    List<StoreOrder> productClosing(@Param("start")String start,@Param("end")String end);

    List<StoreOrder> productPay(@Param("start")String start,@Param("end")String end);

    List<StoreOrder> cardPay(@Param("start")String start,@Param("end")String end);

    List<DetailClientVo> testDetailClient(StoreDateRangeSqlPram pram);
}
